/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

server_root = 'http://localhost/SSOT_SAT/trunk/';

$(".ui-state-error").hide();
 
// Call the button widget method on the login button to format it. 
$("#btnLogin").button()
 
// Now bind a click event to handle the login of the form.
.bind ("click", function(){
    // Test our form for a valid login.  
    // Our form only works with:
    //     username: script
    //     password: junkie
    dataString = 'username='+$("#username").val()+"&password="+$("#password").val();
    server = server_root+"check_login.php";
    $.ajax({

           type: 'GET',
           data: dataString,
           url: server,
           async: false,
           success: function(data){
               if ( data == 1){
                   document.location = 'main.php';
               }
               else if (data == 0){
                   $(".ui-state-error").show();
               }
            }
            });
            
    // return false to cancel normal form submit event methods.
    return false;
});
